import { apiGet, apiPost, apiDelete } from './client'

export interface Enrollment {
  id?: number
  studentId?: number
  offeringId?: number
  status?: string
}

export async function listEnrollments(params: { studentId?: number; offeringId?: number } = {}) {
  return apiGet<Enrollment[]>('/api/grades/enrollments', params)
}

export async function createEnrollment(enrollment: Enrollment) {
  return apiPost<Enrollment>('/api/grades/enrollments', enrollment)
}

export async function deleteEnrollment(id: number) {
  return apiDelete<string>(`/api/grades/enrollments/${id}`)
}

export async function listStudentsByOffering(offeringId: number) {
  return apiGet<any[]>(`/api/grades/enrollments/offering/${offeringId}/students`)
}